<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="author" content="order by dede58.com"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>笔记库后台-分类管理</title>
    <#include "public/link_css.ftl">
    <#include "public/link_js.ftl">
    <#--    <script>window.location.href='upgrade-browser.html';</script>-->
</head>

<body class="user-select">
<section class="container-fluid">
    <#include "public/header.ftl">
    <div class="row">
        <#include "public/left.ftl">
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-lg-10 col-md-offset-2 main" id="main">
            <div class="row">
                <div class="col-md-5">
                    <h1 class="page-header">添加</h1>
                    <form action="/admin/category/add" method="post" autocomplete="off">
                        <div class="form-group">
                            <label for="category-name">分类名称</label>
                            <input type="text" id="category-name" name="categoryName" class="form-control"
                                   placeholder="在此处输入分类名称" required autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label for="category-fname">父分类名称</label>
                            <select id="category-fname" class="form-control" name="patientId">
                                <#if categoryList??>
                                    <#list categoryList as c>
                                        <option value="${c.id}">${c.categoryName}</option>
                                    </#list>
                                <#else>
                                    <option value="0" selected>暂无分类</option>
                                </#if>
                            </select>
                            <span class="prompt-text">分类是有层级关系的，您可以有一个“音乐”分类，在这个目录下可以有叫做“流行”和“古典”的子分类。</span>
                        </div>
                        <button class="btn btn-primary" type="submit" name="submit">添加新分类</button>
                    </form>
                </div>
                <div class="col-md-7">
                    <h1 class="page-header">管理 <span class="badge">${categoryCount}</span></h1>
                    <div class="table-responsive">
                        <table class="table table-striped table-hover">
                            <thead>
                            <tr>
                                <th><span class="glyphicon glyphicon-paperclip"></span> <span
                                            class="visible-lg">ID</span></th>
                                <th><span class="glyphicon glyphicon-file"></span>
                                    <span class="visible-lg">分类名称</span>
                                </th>
                                <th><span class="glyphicon glyphicon-list-alt"></span> <span
                                            class="visible-lg">父级分类</span></th>
                                <#--                                <th><span class="glyphicon glyphicon-pushpin"></span>-->
                                <#--                                    <span class="visible-lg">总数</span>-->
                                <#--                                </th>-->
                                <th><span class="glyphicon glyphicon-pencil"></span>
                                    <span class="visible-lg">操作</span>
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            <#if categoryManagerList??>
                                <#list categoryManagerList as category>
                                    <tr>
                                        <td>${category.id}</td>
                                        <td>${category.categoryName}</td>
                                        <#if category.categoryParentName??>
                                            <td>${category.categoryParentName}</td>
                                        <#else>
                                            <td></td>
                                        </#if>
                                        <#--                                        <td>125</td>-->
                                        <td><a href="/admin/category/update?id=${category.id}">修改</a> <a
                                                    href="/admin/category/delete?id=${category.id}">删除</a></td>
                                    </tr>
                                </#list>
                            </#if>

                            </tbody>
                        </table>
                        <span class="prompt-text"><strong>注：</strong>删除一个栏目分类也会删除分类下的文章和子分类,请谨慎删除!</span></div>
                </div>
            </div>
        </div>
    </div>
</section>

</body>
</html>
